import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'

export default defineConfig({
  plugins: [uni()],
  server: {
    port: 8080,
    host: '0.0.0.0',
    proxy: {
      '/api': {
        target: 'http://59.46.146.11:8090',
        changeOrigin: true,
        secure: false, // 如果目标是 HTTPS 且证书有问题，设为 false
        // 不需要 rewrite，保持 /api 前缀
      },
      '/llm-api': {
        target: 'https://ws.waterism.tech:8091',
        changeOrigin: true,
        secure: false,
        rewrite: (path) => path.replace(/^\/llm-api\/llm\/chat/, '/api/execute')
      }
    }
  }
})